home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / tools / czesc_1 / easyprocess / source / launch / parentsig.c < prev    next >
C/C++ Source or Header  |  1992-09-07  |  1KB  |  76 lines

  1. #include <arpbase.h>
  2. #include <arp_proto.h>
  3. #include "Launch.h"
  4. #include "LaunchPriv.h"
  5.  
  6.  
  7. /*
  8.  *    NAME
  9.  *        AllocParentSignal -- Allocate a signal for child notification.
  10.  *
  11.  *    SYNOPSIS
  12.  *        bit = AllocParentSignal ()
  13.  *
  14.  *        LONG AllocParentSignal (void);
  15.  *
  16.  *    DESCRIPTION
  17.  *        Check if we already launched a process and try to use the same
  18.  *        bit for all processes.  If we can't find a process pair, we
  19.  *        allocate a new bit.
  20.  *
  21.  *    INPUT
  22.  *        None.
  23.  *
  24.  *    OUTPUT
  25.  *        bit - the allocated bit number.
  26.  *
  27.  *    HISTORY
  28.  *        1992/09/07    Pierre Baillargeon        Creation
  29.  */
  30.  
  31. LONG AllocParentSignal (void)
  32. {
  33.     struct ProcPair *Parent;
  34.  
  35.     if (NULL != (Parent = IsParent ((struct Process *)FindTask (NULL))))
  36.     {
  37.         return Parent->pp_ParentBit;
  38.     }
  39.     else
  40.     {
  41.         return (LONG)AllocSignal (-1L);
  42.     }
  43. }
  44.  
  45.  
  46. /*
  47.  *    NAME
  48.  *        FreeParentSignal -- free the signal if it's not used by other.
  49.  *
  50.  *    SYNOPSIS
  51.  *        FreeParentSignal (bit)
  52.  *
  53.  *        void FreeParentSignal (LONG);
  54.  *
  55.  *    DESCRIPTION
  56.  *        Check if the signal bit number is valid and if it is not used
  57.  *        by another process pair.  If not, free it.
  58.  *
  59.  *    INPUT
  60.  *        bit - the bit number.
  61.  *
  62.  *    OUTPUT
  63.  *        None.
  64.  *
  65.  *    HISTORY
  66.  *        1992/09/07    Pierre Baillargeon        Creation
  67.  */
  68.  
  69. void FreeParentSignal (LONG Bit)
  70. {
  71.     if (-1L != Bit && NULL == IsParent ((struct Process *)FindTask (NULL)))
  72.     {
  73.         FreeSignal (Bit);
  74.     }
  75. }
  76.